<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>AngularJS基于模块化的MVC</title>
		<script type="text/javascript" src="../js/angular.min.js"></script>
	</head>
	<!-- ng-app是angular编程入口，是模块作用域  -->

	<body>
		<div ng-app="myapp" ng-controller="myctrl">
			<div>
				<!-- ng-model模型作用  -->
				<input type="text" name="name" ng-model="name" />
			</div>
			<div>
				<!-- {{}} 等价于 ng-bind 用于数据显示 -->
				Hello, {{name}}
			</div>
		</div>
		<script type="text/javascript">
			//初始化myapp模块
			var myapp = angular.module("myapp", []);
			//定义模块的控制器
			//依赖注入,$scope作用域对象,操作当前作用域视图
			myapp.controller("myctrl", ["$scope", function($scope) {
				//对模型进行初始化赋值
				$scope.name = "黑马程序员"
			}])
		</script>
	</body>

</html>